package com.jiawa.train.business.controller.admin;

import com.jiawa.train.common.resp.PageResult;
import com.jiawa.train.common.resp.Result;
import com.jiawa.train.business.req.ConfirmOrderQueryReq;
import com.jiawa.train.business.req.ConfirmOrderDoReq;
import com.jiawa.train.business.service.ConfirmOrderService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/confirmOrder")
@Slf4j
public class ConfirmOrderAdminController {

    @Resource
    private ConfirmOrderService confirmOrderService;
    @PostMapping("/save")
    public Result save(@RequestBody @Valid ConfirmOrderDoReq req) {
        confirmOrderService.save(req);
        return Result.success();
    }
    @GetMapping("/page")
    public Result<PageResult> queryConfirmOrderList(ConfirmOrderQueryReq  req) {
       PageResult pageResult = confirmOrderService.queryConfirmOrderList(req);
       return Result.success(pageResult);
    }
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Long id) {
        confirmOrderService.delete(id);
        return Result.success();
    }
}

